<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./vue.js"></script>
</head>
<!-- 模拟下拉框 [参考效果](https://www.jq22.com/webqd2375) 
 不使用 select 标签
 -->

<body>
    <div id="app">
        <span @click="show =!show">{{a}}</span>
        <ul v-show="show">
            <li v-for="item in arr" @click="list(item)">{{item}}</li>
        </ul>
    </div>
</body>

<script>
    const { createApp, ref } = Vue;

    createApp({
        setup() {

            const show = ref(false);
            const arr = ref(['a', 'b', 'c', 'd']);
            const a = ref('请选择');

            function list(item) {
                a.value = item;
                show.value = false;
            }
            return {
                a,
                show,
                arr,

                list
            }
        }
    }).mount('#app')
</script>

</html>